package com.ocgs.service.impl;

import com.ocgs.dao.impl.SystemAdminDAOImpl;
import com.ocgs.model.SystemAdmin;
import com.ocgs.pagination.PaginatedListImpl;
import com.ocgs.pagination.page.PageContext;
import com.ocgs.service.SystemAdminService;
import org.displaytag.pagination.PaginatedList;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: bryant
 * Date: 10/21/12
 * Time: 3:40 PM
 * To change this template use File | Settings | File Templates.
 */
public class SystemAdminImpl implements SystemAdminService {

    private SystemAdminDAOImpl systemAdminDAO;


    public int deleteByPrimaryKey(Integer id) {
       return systemAdminDAO.deleteByPrimaryKey(id);

    }


    public int insert(SystemAdmin record){
        return systemAdminDAO.insert(record);

    }
    public int insertSelective(SystemAdmin record) {
        return systemAdminDAO.insert(record);
    }

    
    public SystemAdmin selectByPrimaryKey(Integer id) {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    
    public int updateByPrimaryKeySelective(SystemAdmin record) {
        return 0;  //To change body of implemented methods use File | Settings | File Templates.
    }

    
    public int updateByPrimaryKey(SystemAdmin record) {
        return 0;  //To change body of implemented methods use File | Settings | File Templates.
    }

    public void setSystemAdminDAO(SystemAdminDAOImpl systemAdminDAO) {
        this.systemAdminDAO = systemAdminDAO;
    }

    public SystemAdminDAOImpl getSystemAdminDAO() {
        return systemAdminDAO;
    }

    public PaginatedList findAllSystemAdminForPagination(PaginatedListImpl paginatedList,SystemAdmin admin){
        PageContext page = PageContext.getPageContext();
        List<SystemAdmin> admins = systemAdminDAO.findAllSystemAdmin(admin);
        if(admin==null||admins.size()==0)
            return null;
        paginatedList.setList(admins);
        paginatedList.setTotalNumberOfRows(page.getTotalRows());
        return  paginatedList;
    }
}
